   /**
 * 文件名：OrderAction.java
 * 版权：Neusoft Corporation. All Rights Reserved.
 * 描述：订单控制类
 * 创建时间：Sep 21, 2011
 */
package com.neusoft.erc.web.order;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.SessionAware;
import org.hibernate.HibernateException;
import org.springframework.beans.factory.annotation.Autowired;
import com.neusoft.components.orm.Page;
import com.neusoft.components.utils.web.struts2.Struts2Utils;
import com.neusoft.erc.entity.account.User;
import com.neusoft.erc.entity.basis.Constant;
import com.neusoft.erc.entity.franchisee.Franchisee;
import com.neusoft.erc.entity.order.Downlossinfo;
import com.neusoft.erc.entity.order.FeeApproval;
import com.neusoft.erc.entity.order.FreeRide;
import com.neusoft.erc.entity.order.INSUsed;
import com.neusoft.erc.entity.order.MainOrder;
import com.neusoft.erc.entity.order.OrderDiscard;
import com.neusoft.erc.entity.order.RGUsed;
import com.neusoft.erc.entity.order.RGUsedFee;
import com.neusoft.erc.entity.order.Resloss;
import com.neusoft.erc.entity.order.RgUsedout;
import com.neusoft.erc.entity.order.RgUsedreturn;
import com.neusoft.erc.entity.order.SimpleOrder;
import com.neusoft.erc.entity.order.SubOrder;
import com.neusoft.erc.entity.order.VASUsed;
import com.neusoft.erc.entity.order.VirtualOrder;
import com.neusoft.erc.entity.order.VirtualServer;
import com.neusoft.erc.entity.prod.RecommendGoodsib;
import com.neusoft.erc.entity.prod.Vas;
import com.neusoft.erc.entity.store.StoreInfo;
import com.neusoft.erc.entity.vehicle.Vehicle;
import com.neusoft.erc.entity.vehicle.Vinsurance;
import com.neusoft.erc.service.basis.BusinessIntelligentizeService;
import com.neusoft.erc.service.franchisee.FranchiseeManager;
import com.neusoft.erc.service.order.BusinessLogService;
import com.neusoft.erc.service.order.FreeRideService;
import com.neusoft.erc.service.order.INSUsedService;
import com.neusoft.erc.service.order.OrderCatQueryService;
import com.neusoft.erc.service.order.OrderExService;
import com.neusoft.erc.service.order.OrderFeeManager;
import com.neusoft.erc.service.order.OrderManager;
import com.neusoft.erc.service.order.RGUsedService;
import com.neusoft.erc.service.order.RgUsedoutManager;
import com.neusoft.erc.service.order.RgUsedreturnManager;
import com.neusoft.erc.service.order.VASUsedService;
import com.neusoft.erc.service.prod.FreerideSubRelManager;
import com.neusoft.erc.service.prod.RecommendgoodsManager;
import com.neusoft.erc.service.settllement.FeeApprovalManager;
import com.neusoft.erc.service.settllement.PaymentScheduleManager;
import com.neusoft.erc.service.store.StoreInfoManager;
import com.neusoft.erc.service.vehicle.OptinsureManager;
import com.neusoft.erc.service.vehicle.VehicleManager;
import com.neusoft.erc.service.vehicle.VinsuranceManager;
import com.neusoft.erc.web.CrudActionSupport;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;

/**
 * 订单主控制类
 * "/order/order!reverse.action"
 */
@Namespace("/order")
@Results( { @Result(name = CrudActionSupport.RELOAD, location = "order!integeredQuery.action", type = "redirect") })
public class OrderAction extends CrudActionSupport<VirtualOrder> implements SessionAware {
	private static final long serialVersionUID = 6527652276899896117L;
	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(OrderAction.class);

	private Map<String, Object> session;
	private static final String LAST_URL_KEY = "LUK";

	@Autowired
	private OrderManager orderManager;
	/** 车辆业务类 */
	@Autowired
	private VehicleManager vehicleManager;
	/** 订单综合分类查询 */
	@Autowired
	private OrderCatQueryService orderCatQueryService;
	/** 订单辅助服务类 */
	@Autowired
	private OrderExService orderExService;
	@Autowired
	private FreeRideService freeRideService;
	@Autowired
	private OrderFeeManager orderFeeManager;
	@Autowired
	private BusinessIntelligentizeService biService;
	@Autowired
	private StoreInfoManager storeInfoManager;
	@Autowired
	private PaymentScheduleManager paymentScheduleManager;
	@Autowired
	private FreerideSubRelManager freerideSubRelManager;
	@Autowired
	private RgUsedoutManager rgUsedoutManager;
	@Autowired
	private RgUsedreturnManager rgUsedreturnManager;
	@Autowired
	private VASUsedService vASUsedService;
	@Autowired
	private INSUsedService iNSUsedService;
	@Autowired
	private RGUsedService rGUsedService;
	@Autowired
	private RecommendgoodsManager recommendgoodsManager;
	@Autowired
	private VinsuranceManager vinsuranceManager;

	/** 订单审核服务组件 */
	@Autowired
	private FeeApprovalManager feeApprovalManager;
	/** 订单查询条件对象 */
	private SimpleOrder simpleOrder;

	private FreeRide freeride;
	/**顺风车sid*/
	private String freeridesid;

	private Page<SimpleOrder> page = new Page<SimpleOrder>(10);

	/** 用户分组：加盟商用户、非加盟商用户 */
	private String userGroupFlag;
	/**加盟商SID*/
	private String fransid;
	/**加盟商SID*/
	private String fransidto;

	private String currfransid;

	private String approvalStatus;

	private String oldsubtype;// 子订单异常类型 1换车，2续租 3,区间订单

	private String joinfreeride;// 加入顺风车列表
	private String offsite;// 判断是否异地还车

	/**主订单服务类型*/
	private String h_servicetype;
	private VirtualOrder virtualOrder;
	private List<SubOrder> subOrderList;
	private SubOrder subOrder;
	/**物品丢失*/
	private List<Resloss> reslosslist;
	private List<Downlossinfo> downlossinfolist;// 停驶天数信息

	private File[] upload;
	private String[] uploadContentType;
	private String[] uploadFileName;
	private String[] imageFiles;
	private File[] uploads;// 换车页面 出车 附件。--为了验证
	private String[] uploadsContentType;
	private String[] uploadsFileName;
	private int size;// 子订单list长度
	/**
	 * showModalDialog 窗口提交表单.判断是否关闭
	 */
	private String closType;
	/** 菜单 */
	private String menuType;
	/** 主订单SID  用于获取订单详细信息 */
	public String msid;
	/**子订单sid*/
	public String sid;
	/** 客户编号*/
	public String custno;
	/**需换车子订单SID*/
	public String oldsubsid;
	/** 订单类型 */
	public String ordType;
	/** 操作类型 */
	private String optType;

	/** 跳转页面名称*/
	private String yemianName;
	
	public String optinsureFlag;

	// 单个精品使用详细记录
	private List<RgUsedout> rgUsedouts;
	private Date outtime;
	private Date returntime;
	private List<RGUsed> rgUseds;
	private List<VASUsed> vasUseds;
	private List<INSUsed> insUseds;
	private List<RgUsedreturn> rgUsedreturns;
	private VirtualServer virtualServer;

	/**区别详细,编辑*/
	private String buttonType;
	/**判断当前是否为保存操作,页面主动跳转，主动跳转skip=skip*/
	private String skip;
	/**区别管理中心和预订服务中心*/
	private String csMark;
	/**
	 * //还车类型，1.正常流程还车，2.续租还车 ，3.换车还车
	 */
	private String vcollectformtype;
	/**
	 *  出车类型 1.正常出车，续租出车，换车出车
	 */
	private String vregistrationformtype;
	/** 是否显示客户信息边框 */

	/** 用户信息涉及多种业务，用于标识是否显示客户信息边框 */

	private String isBorder;
	/** 订单主页备注 */
	private String remark;

	/** 车辆sid */
	private String vsid;
	private Vehicle vehicle;
	/** 车型图片路径 */
	private String vtimg;
	/**续租页面，判断当前是否超出续租最大值 0 没有 1 有*/
	private String tabtype;

	private List<FeeApproval> approvallist;
	private FeeApproval approval;
	/**异常信息提示字段*/
	private String errorsto;
	/**驾驶类型 自驾 代驾*/
	private String rentaltype;
	@Autowired
	private BusinessLogService businessLogService;

	private String storeid;
	/**
	 * 用于租车办理，判断车辆是否在当前门店
	 */
	private String isHandleboo;

	/**
	 * 用于进入订单页面，判断当前增值服务
	 * @return
	 */
	private String vas1;
	private String vas2;
	private String vastype;

	private String csoperate;// 咨询单操作状态 add by xiao

	public String orderMenuIntQuery() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuReserve() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuConfirm() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuHandle() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuChange() {// 换车
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuDispatch() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuRelet() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuCollect() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuClear() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}

	public String orderMenuApproval() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}
	
	public String orderMenuApprovalForDiscard() {
		session.put(LAST_URL_KEY, menuType);
		orderMgrIndex(menuType);
		return "rent_index";
	}
	/**
	 * 订单返回操作；
	 * @return
	 * @throws Exception 
	 */
	public String returnback() throws Exception {
		if (Constant.RMENU_0.equals(menuType)) {// 清洗
			return orderMenuIntQuery();
		} else if (Constant.RMENU_1.equals(menuType)) {// 订单综合查询
			return orderMenuIntQuery();
		} else if (Constant.RMENU_2.equals(menuType)) {// 预定维护
			return orderMenuReserve();
		} else if (Constant.RMENU_3.equals(menuType)) {// 订单确认
			return orderMenuConfirm();
		} else if (Constant.RMENU_4.equals(menuType)) {// 租车办理
			return orderMenuHandle();
		} else if (Constant.RMENU_5.equals(menuType)) {// 出车
			return orderMenuDispatch();
		} else if (Constant.RMENU_6.equals(menuType)) {// 续租
			return orderMenuRelet();
		} else if (Constant.RMENU_7.equals(menuType)) {// 还车
			return orderMenuCollect();
		} else if (Constant.RMENU_8.equals(menuType)) {// 费用结算
			return orderMenuClear();
		} else if (Constant.RMENU_9.equals(menuType)) {// 换车
			return orderMenuChange();
		} else if (Constant.RMENU_10.equals(menuType)) {// 审核
			return orderMenuApproval();
		} else if (Constant.RMENU_11.equals(menuType)) {// 作废订单审核
			return orderMenuApprovalForDiscard();
		} else if (csMark.equals(Constant.CS_MARK_2)) {// 预定服务租车历史
			return gotorentList();
		} else {
			return "";
		}
	}

	/**
	 * 订单查询
	 * 除订单综合查询功能外，其它子菜单中的查询必须按功能指定订单状态参数
	 */
	public String integeredQuery() throws Exception {

		tuneQueryParams();
		orderMgrIndex(menuType);
		// page = orderCatQueryService.queryOrderList(page, simpleOrder);
		return "rent_index";
	}

	/**
	 * 预订服务中心，快速查询接口,订单信息查询
	 */

	public String fastQuery() throws Exception {
		tuneQueryParams();
		orderMgrIndex(menuType);
		return "rent_index";
	}

	/**
	 * 预订服务中心，快速查询接口，客户租车历史
	 */
	public String gotorentHis() throws Exception {
		tuneQueryParams();
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {
				// 加盟商用户
				simpleOrder.setFranchiseesid(user.getColldeptsid());// 加盟商用户限定查询范围为当前加盟商
				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else if (null != user.getClassifycation()
					&& (Constant.Sys.USERS_TYPE_1.equals(user.getClassifycation()) || Constant.Sys.USERS_TYPE_4
							.equals(user.getClassifycation()))) { // 非管理中心或客服时，需指定加盟商
				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else {
				if (StringUtils.isNotEmpty(simpleOrder.getFranchiseesid())) {
					page = orderCatQueryService.queryOrderList(page, simpleOrder);
				} else {
					page = new Page<SimpleOrder>();
				}
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}
		if (page != null && (null != page.getResult()) && page.getResult().isEmpty()) {
			page.setTotalItems(0L);
		}
		return "rent_history";
	}

	/**
	 * 预订服务中心，快速查询接口，客户租车记录，可添加备注
	 * @author xiaoshaoli
	 */
	public String gotorentList() throws Exception {
		tuneQueryParams();
		User user = (User) Struts2Utils.getCurrentUser();
		//custno = Struts2Utils.getParameter("custno");
		if (StringUtils.isNotEmpty(custno)) {
			simpleOrder.setCustno(custno);
		}
		if (null != user) {
			if (null != user.getClassifycation()
					&& (Constant.Sys.USERS_TYPE_1.equals(user.getClassifycation()) || Constant.Sys.USERS_TYPE_4
							.equals(user.getClassifycation()))) { // 非管理中心或客服时，需指定加盟商
				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.Common.VALID_STATUS_1;
			} else {
				if (StringUtils.isNotEmpty(simpleOrder.getFranchiseesid())) {
					page = orderCatQueryService.queryOrderList(page, simpleOrder);
				} else {
					page = new Page<SimpleOrder>();
				}
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}
		if (page != null && (null != page.getResult()) && page.getResult().isEmpty()) {
			page.setTotalItems(0L);
		}
		return "rent_list";
	}

	/**
	 * 
	 * @throws 客服更改订单  sun
	 */
	public String gotoOrderedit() throws Exception {
		SimpleOrder simpleOrder = new SimpleOrder();
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			List<String> st = new ArrayList();
			st.add(Constant.Order.ORDER_STATUS_2);
			simpleOrder.setStatus(st);
			simpleOrder.setServicetype2(Constant.Order.ORDER_TYPE_7);// 顺风车不在此范围之内
			simpleOrder.setCustno(custno);
		}
		page = orderCatQueryService.queryOrderList(page, simpleOrder);
		userGroupFlag = Constant.Common.VALID_STATUS_1;
		return "rent_history";
	}

	/**
	 * 预定服务中心 车辆预定
	 * @return
	 * @throws Exception 
	 */
	public String gotogetorder() throws Exception {
		session.put(LAST_URL_KEY, menuType);
		return gotoIndividualReverse();
	}

	/*
	 * 违章记录的订单查询框
	 */
	public String gotoorderSearch() throws Exception {
		tuneQueryParams();
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			List<String> st = new ArrayList();
			st.add(Constant.Order.ORDER_STATUS_6);
			st.add(Constant.Order.ORDER_STATUS_8);
			// st.add(Constant.Order.ORDER_STATUS_9);
			simpleOrder.setStatus(st);// 加入过滤条件
			if (StringUtils.isNotEmpty(custno)) {
				simpleOrder.setCustno(custno);
			}
			if(StringUtils.isNotEmpty(optinsureFlag)){
				simpleOrder.setOptinsureFlag(optinsureFlag);
			}
			if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {// 加盟商用户
				simpleOrder.setFranchiseesid(user.getColldeptsid());// 加盟商
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation()))) { // 网点
				simpleOrder.setStoreid(user.getColldeptsid());
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else {
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}

		page = orderCatQueryService.queryOrderList(page, simpleOrder);
		if (page != null && (null != page.getResult()) && page.getResult().isEmpty()) {
			page.setTotalItems(0L);
		}

		return "rent_search";
	}
	/**
	 * --hk
	 * 维保信息添加订单，进行查询
	 * @return
	 * @throws Exception
	 */

	public String gotoorderSearchForoptinsure() throws Exception {
		tuneQueryParams();
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			List<String> st = new ArrayList();
			st.add(Constant.Order.ORDER_STATUS_6);
			st.add(Constant.Order.ORDER_STATUS_8);
			// st.add(Constant.Order.ORDER_STATUS_9);
			simpleOrder.setStatus(st);// 加入过滤条件
			if (StringUtils.isNotEmpty(custno)) {
				simpleOrder.setCustno(custno);
			}
			//--currfransid 当前传递的是vinsurancesid
			if(StringUtils.isNotEmpty(currfransid)){
				Vinsurance  vinsurance  =  this.vinsuranceManager.getBySid(currfransid);
				if(vinsurance!=null){
					simpleOrder.setVehiclelisence(vinsurance.getVehiclelisence());
				}
			}	 
			if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {// 加盟商用户
				simpleOrder.setFranchiseesid(user.getColldeptsid());// 加盟商
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation()))) { // 网点
				simpleOrder.setStoreid(user.getColldeptsid());
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else {
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}

		page = orderCatQueryService.queryOrderList(page, simpleOrder);
		if (page != null && (null != page.getResult()) && page.getResult().isEmpty()) {
			page.setTotalItems(0L);
		}

		return "rent_searchForoptinsure";
	}
	
	
	
	/**
	 * 预订服务中心，进入取消订单界面
	 */
	public String gotoorderCal() throws Exception {
		SimpleOrder simpleOrder = new SimpleOrder();
		simpleOrder.setCustno(custno);
		simpleOrder.setOrdtype(Constant.Order.ORDER_TYPE_1);
		page = orderCatQueryService.queryOrderList(page, simpleOrder);
		return "order_cancel";
	}

	/**
	 * 预订服务中心，取消预订
	 */
	public String ordercancle() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.cancle(user, msid, remark);
		}
		closType = "Y";
		return gotoorderCal();
	}

	public String goOrderUnifyEntrance() {
		// virtualOrder = orderExService.detail(msid);--hk
		virtualOrder = orderManager.details(msid);
		return "order_home";
	}

	public String gotoDetail() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {
				// 加盟商用户
				userGroupFlag = Constant.Common.VALID_STATUS_1;
			} else {
				// 非加盟商用户
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}
		// virtualOrder = orderExService.detail(msid);
		virtualOrder = new VirtualOrder();
		MainOrder order = orderExService.getOrder(msid);

		fransid = order.getFranchiseesid();// sun 2012-3-30加盟上sid
		approvaldiscardlist = this.orderExService.gotoApprovalForDiscard(msid);
		virtualOrder.setMainOrder(order);
		if (yemianName == null || "".equals(yemianName)) {// 详情的情况下跳转
			yemianName = "order_home";
		}
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return yemianName;
		}
	}

	public String gotoUpdate() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			remark = businessLogService.getremark(msid, user.getUserId().toString());
		}

		virtualOrder = orderManager.details(msid);

		MainOrder order = orderExService.getOrder(msid);
		fransid = order.getFranchiseesid();// sun 2012-3-30加盟上sid

		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return "order_home";
		}

	}

	public String gotoConfirm() throws Exception {
		virtualOrder = orderManager.details(msid);
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {
			return gotoFrhandel();
		} else {
			return "order_home";
		}

	}

	/**
	 * 租车办理
	 */
	public String gotoHandle() throws Exception {
		virtualOrder = orderManager.details(msid);
		// -hk 验证当前车辆是否在当前网店
		isHandleboo = String.valueOf(this.orderManager.isHandleboo(msid));
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车

			return gotoFrhandel();
		} else {
			return "order_home";
		}

	}

	/**
	 * 换车
	 */
	public String gotoChange() throws Exception {
		virtualOrder = orderManager.details(msid);
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else {
			return "order_home";
		}

	}

	/**
	 * 进入费用变更审核
	 * @return
	 * @throws Exception
	 */
	public String gotoApproval() throws Exception {
		virtualOrder = orderManager.details(msid);
		// approvalStatus = Constant.ORDER_APPROVAL_1;

		approvallist = this.orderExService.gotoApproval(msid);
		// approval.setAppres(Constant.ORDER_APPROVAL_1);

		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else {
			return "order_home";
		}
	}
	/**
	 * 进入订单作废审核页面
	 * @return
	 * @throws Exception
	 */
	private List<OrderDiscard> approvaldiscardlist;
	public String gotoApprovalForDiscard() throws Exception {
		virtualOrder = orderManager.details(msid);
		// approvalStatus = Constant.ORDER_APPROVAL_1;

		approvaldiscardlist = this.orderExService.gotoApprovalForDiscard(msid);
		// approval.setAppres(Constant.ORDER_APPROVAL_1);

		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else {
			return "order_home";
		}
	}
	
	/**
	 * 保存费用申请
	 * @return
	 * @throws Exception
	 */
	public String approval() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (user != null && approval != null) {
			approval.setUptemplyee(user.getUserId().toString());
			approval.setUptdatetime(new Date());
			feeApprovalManager.saveApproval(approval);
			if (this.feeApprovalManager.queryApproval(approval.getMsid())) {// 判断是否是最后一个申请单
				MainOrder order = orderManager.getMOrder(approval.getMsid());
				if (order != null) {
					order.setIsapproval(Constant.NO);
					orderManager.saveMOrder(order);
				}
			}
			//防止重复弹出提示框
			if("".equals(closType)){//
				closType = "1";
			}else{
				closType = "2";
			}
			
		}
		return "order_FeeApproval";
	}

	public String gotoDispatch() throws Exception {
		virtualOrder = orderManager.details(msid);
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return "order_home";
		}

	}

	public String gotoRelet() throws Exception {
		virtualOrder = orderManager.details(msid);
		if (null != orderManager.getsublists(msid)) {
			size = orderManager.getsublists(msid).size();
		}
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return "order_home";
		}

	}

	public String gotoCollect() throws Exception {
		virtualOrder = orderManager.details(msid);
		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return "order_home";
		}
	}

	/**
	 * 进入结算页面
	 * @return
	 * @throws Exception
	 */
	public String gotoClear() throws Exception {
		virtualOrder = orderManager.details(msid);
		
		if (virtualOrder != null && virtualOrder.getMainOrder() != null) {
			MainOrder order = virtualOrder.getMainOrder();
			if (order != null && order.getIsapproval() != null) {
				approvallist = this.orderExService.gotoApproval(msid);
			}
		}

		// 个人公司预定
		if (Constant.Order.ORDER_TYPE_1.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_2.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "order_home";

		} else if (Constant.Order.ORDER_TYPE_3.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_4.equals(virtualOrder.getMainOrder().getServicetype())) {
			// 维修代步
			return "serOrder_home";
		} else if (Constant.Order.ORDER_TYPE_5.equals(virtualOrder.getMainOrder().getServicetype())
				|| Constant.Order.ORDER_TYPE_6.equals(virtualOrder.getMainOrder().getServicetype())) {
			return "shuttleontime_home";
		} else if (Constant.Order.ORDER_TYPE_7.equals(virtualOrder.getMainOrder().getServicetype())) {// 顺风车
			return gotoFrhandel();
		} else {
			return "order_home";
		}
	}

	public String loadCustOrCoInfoArea() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (StringUtils.isNotEmpty(msid)) {
			virtualOrder = this.orderManager.details(msid);// --hk
		}
		setupUserClassifycation(user);
		return "order_custOrcoInfo";
	}

	/**维修代步客户信息*/
	public String serloadCustOrCoInfoArea() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (StringUtils.isNotEmpty(msid)) {
			// virtualOrder = orderExService.detail(msid);hk
			virtualOrder = orderManager.details(msid);
		} else {
			virtualOrder = new VirtualOrder();
			MainOrder mainOrder = new MainOrder();
			if (Constant.Order.ORDER_TYPE_1.equals(ordType)) {// 由于第一次进来的时候设置了
				// 。详情830行，进入
				mainOrder.setServicetype(Constant.Order.ORDER_TYPE_3);
			} else {
				mainOrder.setServicetype(Constant.Order.ORDER_TYPE_4);
			}
			virtualOrder.setMainOrder(mainOrder);
		}
		setupUserClassifycation(user);
		return "serOrder_custOrcoInfo";
	}

	/**定点接送客户信息*/
	public String shutloadCustOrCoInfoArea() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (StringUtils.isNotEmpty(msid)) {
			// virtualOrder = orderExService.detail(msid);hk
			virtualOrder = orderManager.details(msid);
		} else {
			virtualOrder = new VirtualOrder();
			MainOrder mainOrder = new MainOrder();
			if (Constant.Order.ORDER_TYPE_1.equals(ordType)) {// 由于第一次进来的时候设置了
				// 。详情830行，进入
				mainOrder.setServicetype(Constant.Order.ORDER_TYPE_5);
			} else {
				mainOrder.setServicetype(Constant.Order.ORDER_TYPE_6);
			}
			virtualOrder.setMainOrder(mainOrder);
		}
		setupUserClassifycation(user);
		return "shuttleontime_custOrcoInfo";
	}

	/**
	 * 进入个人预订页面 sun 2012-3-20
	 */
	public String gotoIndividualReverse() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		mainOrder.setServicetype(ordType);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);
		return "order_home";
	}

	/**
	 * 进入公司预订页面 sun 2012-3-20
	 */
	public String gotoComReverse() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		mainOrder.setServicetype(ordType);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);
		return "order_home";
	}

	/**
	 * 进入 个人 定点接送页面
	 */
	public String gotoShuttleOntime() {
		ordType = Constant.Order.ORDER_TYPE_1;
		optType = Constant.ORD_OPT_2;
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		// mainOrder.setServicetype(Constant.Order.ORDER_TYPE_5);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);

		return "shuttleontime_home";
	}

	/**
	 * 进入 公司 定点接送页面
	 */
	public String gotoShuttleOntimeCo() {
		ordType = Constant.Order.ORDER_TYPE_2;
		optType = Constant.ORD_OPT_2;
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		// mainOrder.setServicetype(Constant.Order.ORDER_TYPE_6);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);

		return "shuttleontime_home";
	}

	/**
	 * 定点接送第一步：保存主订单及客户信息
	 */
	public String shuttReserve_sone() throws Exception {

		msid = virtualOrder.getMainOrder().getSid();// HK
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			virtualOrder = orderManager.reserve_sone(user, virtualOrder);
		}

		if (StringUtils.isNotEmpty(msid)) { // iframe 页面保存操作。HK
			return "shuttleontime_custOrcoInfo";
		}

		msid = virtualOrder.getMainOrder().getSid();
		yemianName = "shuttleontime_home";

		return "order_home_skip";

	}

	/**
	 * 预订第一步：保存主订单及客户信息  sun 2012-3-30
	 */
	public String reserve_sone() throws Exception {
		msid = virtualOrder.getMainOrder().getSid();// HK
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			MainOrder mainOrder = virtualOrder.getMainOrder();
			mainOrder.setServicetype(ordType);
			virtualOrder = orderManager.reserve_sone(user, virtualOrder);
		}
		if (StringUtils.isNotEmpty(msid)) { // iframe 页面保存操作。HK
			return "order_custOrcoInfo";
		}

		msid = virtualOrder.getMainOrder().getSid();
		// msid = UUID.randomUUID().toString();
		yemianName = "order_home";
		return "order_home_skip";
		// return gotoDetail();// "reserve_index";

	}

	/**
	 * 维修代步第一步：保存主订单及客户信息
	 */
	public String serreserve_sone() throws Exception {
		msid = virtualOrder.getMainOrder().getSid();// HK
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			virtualOrder = orderManager.reserve_sone(user, virtualOrder);
		}

		if (StringUtils.isNotEmpty(msid)) { // iframe 页面保存操作。HK
			return "serOrder_custOrcoInfo";
		}

		msid = virtualOrder.getMainOrder().getSid();
		yemianName = "serOrder_home";
		return "order_home_skip";
	}

	/**
	 * 预订第二步：生成订单
	 */
	public String reserve_stwo() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.reserve_stwo(user, virtualOrder, msid, remark);
		}
		return invokeLastUrl();// "reserve_index";
	}

	/**
	 * 保存草稿
	 */
	public String saveDraft() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.saveDraft(user, msid, remark, "1");
		}
//		System.out.print(menuType);
		return invokeLastUrl();// "reserve_index";
	}

	/**
	 * 预定中心
	 * 清洗数据暂存
	 */
	public String saveDraftcentre() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.saveDraft(user, msid, remark, "0");
		}
		return invokeLastUrl();// "reserve_index";
	}

	/**
	 * 取消预订
	 * @throws Exception 
	 */
	public String cancle() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.cancle(user, msid, remark);
		}
		if (Constant.CS_MARK_3.equals(csMark)) {// 预定服务中心取消时候。返回的页面
			csMark = Constant.CS_MARK_2;
			return gotoOrderedit();
		} else {
			return invokeLastUrl();
		}
	}

	/**
	 * 关闭订单
	 * @return
	 */
	public String close() {
		if (StringUtils.isEmpty(menuType)) {
			menuType = Constant.RMENU_8;
			if (StringUtils.isNotEmpty(msid)) {
				orderManager.close(msid);
			}
		}
		return orderMenuClear();
	}

	/**
	 * 退回修改
	 */
	public String back2Modify() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.back2Modify(user, msid, remark);
		}
		return invokeLastUrl();
	}
	
	/**
	 * 订单确认
	 */
	public String confirm() throws Exception {
		// 此处的虚拟订单仅需要包含订单ID、子订单ID、备注以及费用信息
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.confirm(user, msid, remark);
		}
		if (Constant.CS_MARK_3.equals(csMark)) {// 预定服务中心确认时候。返回的页面
			csMark = Constant.CS_MARK_2;
			return gotoOrderedit();
		} else {
			return invokeLastUrl();
		}
	}

	/**
	 * 订单办理
	 */
	public String handle() throws Exception {
		// 此处的虚拟订单仅需要包含订单ID、子订单ID、备注以及费用信息
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.handle(user, msid, remark);
		}
		return invokeLastUrl();
	}

	/**
	 * 进入出车页面
	 */
	public String gotoDispatchAdd() throws Exception {
		if (StringUtils.isNotEmpty(sid)) {
			subOrder = orderExService.querySubOrderBysid(sid);
			rgUseds = orderExService.getRgUsedsbysid(sid);// 此sid为子订单sid,查询可出的精品列表
			vasUseds = vASUsedService.getVASUsedList(sid);// 此sid为子订单sid,查询可出的增值服务列表
			insUseds = iNSUsedService.getINSUsedList(sid);
			virtualOrder = orderExService.detail(subOrder.getMsid());
			vehicle = vehicleManager.getBySid(vsid);
		}

		return "dispatch";
	}

	/**
	 * 出车
	 */
	public String dispatch() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			if (virtualOrder.getSubOrder() != null) {
				List<String> fileUrl = orderManager.uploadDCSheet(Constant.ORDER_INSPECTIONSLIP_1, upload,
						uploadFileName, virtualOrder.getSubOrder().getSubno(), msid, virtualOrder.getSubOrder()
								.getPlatenumber());// 附件路径
				if (!fileUrl.isEmpty()) {
					if (virtualOrder.getDispatchSheet() != null) {
						if (fileUrl.get(0) != null) {
							virtualOrder.getDispatchSheet().setAttachment(fileUrl.get(0));// 就一个路径
						}
					}
				}
				if (virtualServer == null) {
					virtualServer = new VirtualServer();
				}
				if (null != rgUseds) {
					virtualServer.setRgUseds(rgUseds);
				}
				if (null != vasUseds) {
					virtualServer.setVasUseds(vasUseds);
				}
				if (null != insUseds) {
					virtualServer.setInsUseds(insUseds);
				}

				closType = orderManager.dispatch(user, virtualOrder, virtualServer);

				if (StringUtils.isNotEmpty(msid)) {
					h_servicetype = orderExService.getOrder(msid).getServicetype();// 为了顺风车而设置的。
				}
			}

		}
		return gotoDispatchAdd();
	}

	/**
	 * 进入还车页面
	 */
	public String gotoCollectAdd() throws Exception {
		if (StringUtils.isNotEmpty(sid)) {
			rgUsedouts = rgUsedoutManager.getRgUsedouts(sid);
			subOrder = orderExService.querySubOrderBysid(sid);
			// virtualOrder = orderExService.detail(subOrder.getMsid());--hk

		}
		return "collect";
	}

	/**
	 * 收车
	 */
	public String collect() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			if (virtualOrder.getSubOrder() != null) {
				List<String> fileUrl = orderManager.uploadDCSheet(Constant.ORDER_INSPECTIONSLIP_2, upload,
						uploadFileName, virtualOrder.getSubOrder().getSubno(), msid, virtualOrder.getSubOrder()
								.getPlatenumber());// 附件路径
				if (fileUrl != null && fileUrl.size() > 0) {
					if (virtualOrder.getCollectSheet() != null) {
						if (fileUrl.get(0) != null) {
							virtualOrder.getCollectSheet().setAttachment(fileUrl.get(0));// 上传文件路径
						}
					}
				}
				if (virtualServer == null) {
					virtualServer = new VirtualServer();
				}
				if (null != rgUsedreturns) {
					virtualServer.setRgUsedreturns(rgUsedreturns);
				}
				if (null != reslosslist) {
					virtualServer.setReslosslist(reslosslist);
				}

				if (null != downlossinfolist) {
					virtualServer.setDownlossinfolist(downlossinfolist);
				}
				closType = orderManager.collect("1", user, virtualOrder, virtualServer);// 收车

				SubOrder s = orderExService.querySubOrder(virtualOrder.getSubOrder().getSid());
				if (Constant.IS_OFFSITE_YES.equals(orderExService.offsite(s))) {// 异地还车时候加入异地还车表
					if (StringUtils.isNotEmpty(msid)) {
						orderManager.saveFreerideSubRel(msid, virtualOrder);
					}
				}

				if (StringUtils.isNotEmpty(msid)) {
					h_servicetype = orderExService.getOrder(msid).getServicetype();
				}
			}
		}
		return gotoCollectAdd();
	}

	/**
	 * 进入物品损失登记
	 */
	public String gotoResloss() throws Exception {
		return "resloss";
	}

	public void phyDeleteOrder() throws IOException {
		session.put(LAST_URL_KEY, menuType);
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.phyDeleteOrder(msid);
		}
		Struts2Utils.getResponse().sendRedirect("order!orderMenuReserve.action?menuType=" + menuType);

	}

	/**
	 * 个人进入维修代步页面
	 */
	public String gotoMaintainWalking() {
		ordType = Constant.Order.ORDER_TYPE_1;
		optType = Constant.ORD_OPT_2;
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		mainOrder.setServicetype(Constant.Order.ORDER_TYPE_3);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);
		return "serOrder_home";
	}

	/**公司维修代步*/

	public String gotoMaintainWalkingCo() {
		ordType = Constant.Order.ORDER_TYPE_2;
		optType = Constant.ORD_OPT_2;
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		virtualOrder = new VirtualOrder();// 设定订单类型
		MainOrder mainOrder = new MainOrder();
		mainOrder.setServicetype(Constant.Order.ORDER_TYPE_4);
		if (userGroupFlag.equals(Constant.Common.VALID_STATUS_1)) {
			mainOrder.setFranchiseesid(user.getColldeptsid());
		} else if ("2".equals(userGroupFlag)) {
			mainOrder.setFranchiseesid(this.storeInfoManager.getSelectBySid(user.getColldeptsid()).getFransid());
		}
		virtualOrder.setMainOrder(mainOrder);
		return "serOrder_home";
	}

	/**
	 * 设置用户身份组标志 
	 */
	private void setupUserClassifycation(User user) {
		if (null != user) {
			if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation()))) {
				// 加盟商用户、网点员工
				userGroupFlag = Constant.Common.VALID_STATUS_1;

			} else if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {
				userGroupFlag = "2";
			} else {
				// 非加盟商用户
				userGroupFlag = Constant.Common.VALID_STATUS_0;
			}
		}
	}

	/**
	 * 
	 * @return 更新子订单，此用来更换网点，sun,顺风车准备。
	 * @throws ParseException
	 */
	public String updatesubOrder() throws ParseException {
		if (virtualOrder == null) {
			virtualOrder = new VirtualOrder();
		}

		SubOrder s = new SubOrder();
		if (StringUtils.isNotEmpty(subOrder.getSid())) {
			s = orderExService.querySubOrder(subOrder.getSid());
		}
		if (StringUtils.isNotEmpty(subOrder.getReturncarstoreid())) {
			s.setReturncarstoreid(subOrder.getReturncarstoreid());
			StoreInfo storeInfo = storeInfoManager.getBySid(subOrder.getReturncarstoreid());
			if (storeInfo != null) {
				String fransid = storeInfo.getFransid();
				s.setFranchiseesidex(fransid);// 设置还车网点的加盟商sid
			}
		}
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderExService.saveSubOrder(s, user);
		}
		closType = "1";// 关闭页面

		return "hireInfo-openReserveUpdate";
	}

	/**
	 * 
	 * @return 更新子订单，此用来更换顺风车的还车网点 2012-4-20 sun
	 * @throws ParseException
	 */
	public void updatefreesubOrder() throws ParseException {
		if (virtualOrder == null) {
			virtualOrder = new VirtualOrder();
		}

		String returncarstoreid = Struts2Utils.getParameter("returncarstoreid");// 此为顺风车提交变更
		String subsid = Struts2Utils.getParameter("subsid");
		if (null == subOrder) {
			subOrder = new SubOrder();
		}
		if (StringUtils.isNotEmpty(returncarstoreid)) {
			subOrder.setReturncarstoreid(returncarstoreid);
		}
		if (StringUtils.isNotEmpty(subsid)) {
			subOrder.setSid(subsid);
		}

		SubOrder s = new SubOrder();
		if (StringUtils.isNotEmpty(subOrder.getSid())) {
			s = orderExService.querySubOrder(subOrder.getSid());
		}
		if (StringUtils.isNotEmpty(subOrder.getReturncarstoreid())) {
			s.setReturncarstoreid(subOrder.getReturncarstoreid());
			StoreInfo storeInfo = storeInfoManager.getBySid(subOrder.getReturncarstoreid());
			if (storeInfo != null) {
				String fransid = storeInfo.getFransid();
				s.setFranchiseesidex(fransid);// 设置还车网点的加盟商sid
			}
		}
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderExService.saveSubOrder(s, user);
		}
		Struts2Utils.renderJson("1");

	}

	/**
	 * 顺风车
	 */
	public String gotoFreeRide() {
		return "freeride_home";
	}

	/**
	 * 加载顺风车子订单
	 * @return
	 */
	public String gotofrSuborder() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (StringUtils.isNotEmpty(msid)) {
			subOrderList = orderExService.querySubOrderList(msid);
			if (subOrderList != null && subOrderList.size() > 0) {
				subOrder = subOrderList.get(0);
				if (subOrder.getGetcartime() != null) {
					String times = subOrder.getGetcartime().toString();
					String hour = times.substring(11, 13);
					String minute = times.substring(14, 16);
					subOrder.setHour(hour);
					subOrder.setMinute(minute);
				}

				if (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {// 网点员工
					storeid = user.getColldeptsid();
				}
			}

			freeride = freeRideService.findbyMsid(msid);
			if (null != freeride) {
				DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
				Date date = new Date();
				if (date.getTime() > freeride.getBegindate().getTime()) {
					freeride.setEffectivedate(df.format(date));
				} else {
					freeride.setEffectivedate(df.format(freeride.getBegindate()));
				}
			}
		}
		return "freeride_suborder";
	}

	/**
	 * 顺风车预订
	 */
	public String freeride_stwo() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.freeride_stwo(user, virtualOrder, msid, remark, freeridesid);
		}
		return invokeLastUrl();// "reserve_index";
	}

	/**
	 * 顺风车保存子订单
	 * @throws SQLException 
	 */
	public String saveFreesubOrder() throws ParseException, SQLException {
		User user = (User) Struts2Utils.getCurrentUser();
		subOrder.setRentaltype(Constant.Order.RENTAL_TYPE_1);// 先把顺风车弄成自驾

		if (StringUtils.isNotEmpty(subOrder.getMsid())) {
			FreeRide freeride = freeRideService.findbyMsid(subOrder.getMsid());
			if (null != freeride && StringUtils.isNotEmpty(freeridesid)) {
				if (!(freeride.getSid().equals(freeridesid))) {// 页面提交过来的顺风车sid和原订单保存的sid不一样时。
					if (StringUtils.isNotEmpty(freeridesid)) {// 由前台传来的值来判断是否执行
						rgUseds = orderExService.listRgUsed(subOrder.getMsid());
						if (rgUseds != null && rgUseds.size() > 0) {
							for (RGUsed r : rgUseds) {
								if (StringUtils.isNotEmpty(r.getSid())) {
									orderExService.delRgUsed(user, r.getSid());
								}
							}
						}

					}
				}
			}

			freeride = freeRideService.findbyMsid(subOrder.getMsid());
			if (null != freeride && StringUtils.isNotEmpty(freeridesid)) {
				if (!(freeride.getSid().equals(freeridesid))) {// 页面提交过来的顺风车sid和原订单保存的sid不一样时。
					freeRideService.firefreeride(freeride); // 释放掉原有的顺风车，保存现有的。
				}
			}

		}

		addSubOrder();
		rgUseds = orderExService.listRgUsed(subOrder.getMsid());
		if (rgUseds.size() == 0) {
			orderExService.freerideRgUsed(user, freeridesid, subOrder.getMsid(), subOrder.getSid());// 由顺风车sid来获取订单保存精品使用记录
		}
		return gotofrSuborder();
	}

	/**
	 * 进入顺风车取消
	 */
	public String freeridecancle() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			if (StringUtils.isNotEmpty(msid)) {
				orderManager.freeridecancle(user, msid, remark, null);
			}
		}
		return invokeLastUrl();
	}

	/**
	 * 进入顺风车办理页面
	 */
	public String gotoFrhandel() {
		if (StringUtils.isNotEmpty(msid)) {
			MainOrder order = orderExService.getOrder(msid);
			freeride = freeRideService.findbyMsid(msid);
			if (freeride != null) {
				freeridesid = freeride.getSid();
			}
			subOrderList = orderExService.querySubOrderList(msid);
			if (subOrderList != null && subOrderList.size() > 0) {
				subOrder = subOrderList.get(0);
				if (StringUtils.isNotEmpty(subOrder.getFranchiseesidex())) {
					fransid = subOrder.getFranchiseesidex();// 还车门店加盟商,在顺风车是订单所属加盟商
				}
				if (StringUtils.isNotEmpty(subOrder.getFranchiseesid())) {
					currfransid = subOrder.getFranchiseesid();// 当前加盟商
				}
			}
		}
		return "freeride_home";
	}

	/**
	 * 顺风车确认
	 */
	public String FrConfirm() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.confirm(user, msid, remark);
		}
		return invokeLastUrl();
	}

	/**
	 * 顺风车办理页面
	 */
	public String Frhandle() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.handle(user, msid, remark);
		}
		return invokeLastUrl();
	}

	/**
	 * 进入租车支付页面
	 */
	public String gotoBusinessOptPay() throws Exception {
		return "businessoptpay";
	}

	/**
	 * 保存客户信息 
	 */
	public void saveCustInfo() throws HibernateException, SQLException {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.saveCustOrCoInfo(user, virtualOrder);
		}
	}

	/**
	 * 保存子订单（车辆预订信息） 
	 * @throws ParseException 
	 * @throws SQLException 
	 */
	public String addSubOrder() throws ParseException, SQLException {
		if (virtualOrder == null) {
			virtualOrder = new VirtualOrder();
		}
		if (StringUtils.isNotEmpty(subOrder.getMsid())) {
			paymentScheduleManager.delPaymentSchedules(subOrder.getMsid());// 编辑子订单的时候，如果存在付款计划则删除付款计划
			// 2012-3-25
		}

		String hour = subOrder.getHour();
		String minute = subOrder.getMinute();
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date getcartime = null;
		Date returncartime = null;
		if (!"1".equals(subOrder.getUnit())) {// 天与月租
			getcartime = df.parse(subOrder.getGetcardate() + " " + hour + ":" + minute + ":" + "00");
			returncartime = df.parse(subOrder.getRetcardate() + " " + hour + ":" + minute + ":" + "00");
		} else {// 小时租
			getcartime = df.parse(subOrder.getGetcardate() + " " + hour + ":" + minute + ":" + "00");
			returncartime = df
					.parse(subOrder.getRetcardate() + " " + subOrder.getRetHour() + ":" + minute + ":" + "00");
		}
		subOrder.setGetcartime(getcartime);
		subOrder.setReturncartime(returncartime);
		virtualOrder.setSubOrder(subOrder);
		User user = (User) Struts2Utils.getCurrentUser();
		MainOrder mainOrder = new MainOrder();
		if (StringUtils.isNotEmpty(subOrder.getMsid())) {
			mainOrder = orderManager.getMOrder(subOrder.getMsid());
		}

		if (null != user) {
			if (Constant.Order.ORDER_TYPE_7.equals(mainOrder.getServicetype())) {// 如果是顺风车
				orderManager.savefreeRideSub(user, virtualOrder, freeridesid);
			} else {
				errorsto = orderManager.saveSubOrder(user, virtualOrder);
			}
		}

		if (StringUtils.isNotEmpty(subOrder.getSid()) && StringUtils.isNotEmpty(subOrder.getUnitto())) {// 编辑的时候，对精品和增值服务费用从新计算，
			// sun
			// 2012-4-18
			rgUseds = rGUsedService.findRGbysubsid(subOrder.getSid());
			if (null != rgUseds && rgUseds.size() > 0) {// 精品
				for (RGUsed rg : rgUseds) {
					RGUsedFee rgusedfee = new RGUsedFee();
					if (!subOrder.getUnitto().equals(subOrder.getUnit())) {// --hk
						// 存在租赁周期
						// 改变则精品需要改变
						List<RecommendGoodsib> listre = this.recommendgoodsManager.findListForOrder(subOrder.getSid(),
								rg.getRgsid());
						if (listre != null && listre.size() > 0) {
							rg.setUnit(listre.get(0).getRgrcunit());
							rg.setCurrprice(Double.valueOf(listre.get(0).getRgprice()));
							this.rGUsedService.saveRGUsed(rg, null, user);

						} else {// 不存在定价。删除信息。并且删除对应费用
							this.orderExService.delRgUsed(user, rg.getSid());
						}
					} else {
						rgusedfee.setRgused(rg);
						orderFeeManager.recommendgoodsFeepredict("1", rgusedfee, user, null);
					}

				}
			}

			vasUseds = vASUsedService.getAlListbysubsid(subOrder.getSid());// 增值服务
			if (null != vasUseds && vasUseds.size() > 0) {
				for (VASUsed vas : vasUseds) {
					orderFeeManager.valueaddedFeeret("1", vas, user, null, null);
				}
			}
		}

		closType = "1";// 关闭页面
		return "hireInfo-openReserveUpdate";
	}

	/**
	 * 进入换车车页面
	 */
	public String gotoSubOrdercar() {

		// 订单信息
		if (StringUtils.isNotEmpty(sid)) {
			subOrder = orderExService.querySubOrderBysid(sid);
			if (subOrder.getGetcartime() != null) {
				String times = subOrder.getGetcartime().toString();
				String hour = times.substring(11, 13);
				String minute = times.substring(14, 16);
				subOrder.setHour(hour);
				subOrder.setMinute(minute);
			}
			if (StringUtils.isNotEmpty(subOrder.getVtno())) {
				vtimg = orderExService.getVtimage(subOrder.getVtno());
			}
		}

		// 还车信息
		if (StringUtils.isNotEmpty(sid)) {
			//上面已经执行。避免重新执行
			//subOrder = orderExService.querySubOrderBysid(sid);
			virtualOrder = orderExService.detail(subOrder.getMsid());
		}

		if (StringUtils.isNotEmpty(oldsubsid)) {
			subOrder.setOldsubsid(oldsubsid);
		}
		oldsubtype = "1";
		return "hireInfo-openReserveUpdateChanging";

	}

	/**
	 * 换车 选中车辆，出车信息
	 * 
	 */
	public void gotoDispatchinfo() {
		if (StringUtils.isNotEmpty(vsid)) {
			vehicle = vehicleManager.getBySid(vsid);
			if (vehicle != null) {
				String jsonStr = "[{\"currmileage\":" + vehicle.getCurrmileage() + ",\"curroilmass\":"
						+ vehicle.getCurroilmass() + "}]";
				Struts2Utils.renderJson(jsonStr);
			}
		}
	}

	/**
	 * 换车辆  
	 * @throws ParseException 
	 * @throws IOException 
	 * @throws SQLException 
	 * @throws NullPointerException 
	 * */
	public String updateSubOrdercar() throws ParseException, IOException, NullPointerException, SQLException {
		User user = (User) Struts2Utils.getCurrentUser();
		if (user != null) {

			if (virtualOrder == null) {
				virtualOrder = new VirtualOrder();
			}

			subOrder.setOldsubtype("1");// 换车信息
			String hour = subOrder.getHour();
			String minute = subOrder.getMinute();
			DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Date getcartime = df.parse(subOrder.getGetcardate() + " " + hour + ":" + minute + ":" + "00");
			Date returncartime = df.parse(subOrder.getRetcardate() + " " + hour + ":" + minute + ":" + "00");
			subOrder.setGetcartime(getcartime);
			subOrder.setReturncartime(returncartime);
			subOrder.setRentbegin(getcartime);
			subOrder.setRentend(returncartime);

			if (virtualServer == null) {
				virtualServer = new VirtualServer();
			}
			if (null != rgUsedreturns) {
				virtualServer.setRgUsedreturns(rgUsedreturns);
			}
			if (null != reslosslist) {
				virtualServer.setReslosslist(reslosslist);
			}

			if (null != downlossinfolist) {
				virtualServer.setDownlossinfolist(downlossinfolist);
			}

			orderManager.updateSubOrdercar(subOrder, virtualOrder, user, upload, uploadFileName, uploads,
					uploadsFileName, virtualServer);

			// 手动清除超期还车的提醒 ---sun
			String msgcode = Constant.BA_TYPE_101_06 + msid;
			biService.manualClearMsg(Constant.BA_TYPE_101, msgcode);

			//判断当前费用体系会采用哪个一
			if(subOrder!=null && subOrder.getOldsubsid()!=null){
				SubOrder sub = orderExService.querySubOrderBysid(subOrder.getOldsubsid());
				if(sub!=null){
					if(subOrder.getFactrental()>=sub.getFactrental()){//取价格低的订单费用体系，当相同取第一个订单
						closType = "换车后的费用体系采用车辆："+sub.getPlatenumber();
					}else {
						closType = "换车后的费用体系采用车辆："+subOrder.getPlatenumber();
					}
				}
			}
			if(closType==null || "".equals(closType)){
				closType = "1";// 关闭页面
			}
		}

		return "hireInfo-openReserveUpdateChanging";
	}

	// 进入续租页面
	public String gotoSubOrdercarReletcar() throws ParseException {
		if (StringUtils.isNotEmpty(sid)) {
			subOrder = orderExService.querySubOrderBysid(sid);
			if (subOrder.getGetcartime() != null) {
				String times = subOrder.getGetcartime().toString();
				String hour = times.substring(11, 13);
				String minute = times.substring(14, 16);
				subOrder.setHour(hour);
				subOrder.setMinute(minute);
			}
			if (StringUtils.isNotEmpty(subOrder.getVtno())) {
				vtimg = orderExService.getVtimage(subOrder.getVtno());
			}

			rgUsedouts = rgUsedoutManager.getRgUsedouts(sid);

			if (StringUtils.isNotEmpty(subOrder.getMsid())) {
				MainOrder mainOrder = orderExService.getOrder(subOrder.getMsid());
				h_servicetype = mainOrder.getServicetype();
			}

		}

		return "hireInfo-openReserveUpdateReletcar";

	}

	/**
	 * 续租
	 * @return
	 * @throws ParseException
	 * @throws IOException 
	 */
	public String updateSubOrdercarReletcar() throws ParseException, IOException {

		if (virtualOrder == null) {
			virtualOrder = new VirtualOrder();
		}

		virtualOrder.setSubOrder(subOrder);
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			subOrder = orderManager.updateSubOrdercarReletcar(virtualOrder, user, tabtype, upload, uploadFileName,
					uploads, uploadsFileName);
		}

		// 手动清除超期还车的提醒 ---sun
		String msgcode = Constant.BA_TYPE_101_06 + msid;
		biService.manualClearMsg(Constant.BA_TYPE_101, msgcode);

		closType = "1";// 关闭页面
		if (StringUtils.isNotEmpty(subOrder.getMsid())) {
			MainOrder mainOrder = orderExService.getOrder(subOrder.getMsid());
			h_servicetype = mainOrder.getServicetype();
		}

		return "hireInfo-openReserveUpdateReletcar";
	}

	/**
	 * 
	 * @return
	 * @throws ParseException
	 */
	public String gotochangeStore() throws ParseException {
		if (StringUtils.isNotEmpty(sid)) {
			subOrder = orderExService.querySubOrderBysid(sid);
			if (subOrder.getGetcartime() != null) {
				String times = subOrder.getGetcartime().toString();
				String hour = times.substring(11, 13);
				String minute = times.substring(14, 16);
				subOrder.setHour(hour);
				subOrder.setMinute(minute);
			}
			if (StringUtils.isNotEmpty(subOrder.getVtno())) {
				vtimg = orderExService.getVtimage(subOrder.getVtno());
			}
		}
		if (StringUtils.isNotEmpty(oldsubsid)) {// 换车,续租操作
			subOrder.setOldsubsid(oldsubsid);
		}

		return "hireInfo-openReservechangeStore";

	}

	// 查询子订单
	public String querySubOrderList() {
		User user = (User) Struts2Utils.getCurrentUser();

		if (Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {// 加盟商用户
			// 这个有值
			fransid = user.getColldeptsid();
		}

		if (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {// 网点员工
			storeid = user.getColldeptsid();
		}

		if (StringUtils.isNotEmpty(msid)) {
			subOrderList = orderExService.querySubOrderList(msid);
			size = subOrderList.size();
			if (StringUtils.isNotEmpty(msid)) {
				MainOrder order = orderExService.getOrder(msid);
				if (order != null) {
					if (Constant.Order.ORDER_TYPE_5.equals(order.getServicetype()) // 定点接送页面跳转
							|| Constant.Order.ORDER_TYPE_6.equals(order.getServicetype())) {
						return "shuhireInfo-mainopenReserve";
					}
				}
			}
		}

		return "hireInfo-mainopenReserve";
	}

	// 查询定点接送的子订单
	public String queryshuttlesubList() {
		if (StringUtils.isNotEmpty(msid)) {
			subOrderList = orderExService.querySubOrderList(msid);
			size = subOrderList.size();
		}
		return "shuhireInfo-mainopenReserve";
	}

	// 确认订单验证
	public void SubOrderList() throws IOException {
		HttpServletResponse response = Struts2Utils.getResponse();
		PrintWriter out = response.getWriter();
		if (StringUtils.isNotEmpty(msid)) {
			subOrderList = orderExService.querySubOrderList(msid);
			if (subOrderList.size() != 0) {
				out.print("y");

			} else {
				out.print("n");
			}
		}

	}

	// 查询指定子订单
	public String querySubOrderBysid() {
		User user = (User) Struts2Utils.getCurrentUser();
		List<SubOrder> sList = orderExService.querySubList(msid);
		String storesid = "";
		if (StringUtils.isNotEmpty(sid)) {// 子订单sid不为空 就是编辑
			subOrder = orderExService.querySubOrderBysid(sid);
			if (null != sList) {
				if (sList.size() == 1) {
					fransid = "";// 当之有一个子订单的时候，其加盟商为空。则可以选择任何网点。。sun2012-4-9
					rentaltype = null;// 只有一个订单，编辑
				} else {
					rentaltype = sList.get(0).getRentaltype();// 多个订单。。
					storesid = sList.get(0).getGetcarstoreid();// 存在多个子订单的编辑的时候，网点固定。sun-2012-4-13
					buttonType = "2";// 传值是取车网点不弹出选择框
				}

			}
			if (subOrder.getGetcartime() != null) {
				if (!"1".equals(subOrder.getUnit())) {// 非小时租车
					String times = subOrder.getGetcartime().toString();
					String hour = times.substring(11, 13);
					String minute = times.substring(14, 16);
					subOrder.setHour(hour);
					subOrder.setMinute(minute);
					subOrder.setRetHour(times.substring(11, 13));
				} else {
					String times = subOrder.getGetcartime().toString();
					String rtime = subOrder.getReturncartime().toString();

					String hour = times.substring(11, 13);
					String minute = times.substring(14, 16);
					subOrder.setHour(hour);
					subOrder.setMinute(minute);
					subOrder.setRetHour(rtime.substring(11, 13));
				}
			}
			// --hk
			subOrder.setPsidto(subOrder.getPid());
			if (StringUtils.isNotEmpty(subOrder.getVtno())) {
				vtimg = orderExService.getVtimage(subOrder.getVtno());
			}
			// --hk选车加盟商SID
			StoreInfo storeInfo = this.storeInfoManager.getSelectBySid(subOrder.getStoresid());
			if (storeInfo != null) {
				fransidto = storeInfo.getFransid();
			}

			/**
			 * --hk
			 * 网店 送车上门，上门手车。服务判断
			 */
			if (StringUtils.isNotEmpty(subOrder.getGetcarstoreid())) {// 网店用户登录
				Vas vaso = this.orderExService.findVasbo(subOrder.getGetcarstoreid(), Constant.PROD_VASTYPE_0101);
				if (vaso != null) {
					if (vaso.getVasprice() != null) {
						vas1 = "1";
					}
				}
				Vas vass = this.orderExService.findVasbo(subOrder.getGetcarstoreid(), Constant.PROD_VASTYPE_0102);
				if (vass != null) {
					if (vass.getVasprice() != null) {
						vas2 = "1";
					}
				}
			}

		}

		else {// 新增子订单时候------sun
			if (sList.size() > 0) {// 存在则取第一个订单的租赁方式
				rentaltype = sList.get(0).getRentaltype();
				storesid = sList.get(0).getGetcarstoreid();// 已经存在子订单则
				buttonType = "2";// 传值是取车网点不弹出选择框
			} else {
				rentaltype = null;
			}

			/**
			 * --hk
			 * 网店 送车上门，上门手车。服务判断
			 */
			if (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {// 网店用户登录
				Vas vaso = this.orderExService.findVasbo(user.getColldeptsid(), Constant.PROD_VASTYPE_0101);
				if (vaso != null) {
					if (vaso.getVasprice() != null) {
						vas1 = "1";
					}
				}
				Vas vass = this.orderExService.findVasbo(user.getColldeptsid(), Constant.PROD_VASTYPE_0102);
				if (vass != null) {
					if (vass.getVasprice() != null) {
						vas2 = "1";
					}
				}
			}

		}

		if (StringUtils.isNotEmpty(oldsubsid)) {// 换车,续租操作
			subOrder.setOldsubsid(oldsubsid);
		}
		setupUserClassifycation(user);
		if (null == subOrder
				&& (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation()) || StringUtils.isNotEmpty(storesid))) {// 网店进入子订单预订页面
			String getcarstoresid = "";
			if (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {
				getcarstoresid = user.getColldeptsid();
			} else if (StringUtils.isNotEmpty(storesid)) {
				getcarstoresid = storesid;
			}
			StoreInfo storeInfo = this.storeInfoManager.getSelectBySid(getcarstoresid);
			if (storeInfo != null) {
				subOrder = new SubOrder();
				subOrder.setGetstorename(storeInfo.getStorename());
				subOrder.setStoreno(storeInfo.getStoreno());
				subOrder.setGetcarstoreid(storeInfo.getSid());
				subOrder.setReturnstorename(storeInfo.getStorename());
				subOrder.setReturncarstoreid(storeInfo.getSid());
				buttonType = "2";// 传值是取车网点不弹出选择框
				fransid = storeInfo.getFransid();
				fransidto = storeInfo.getFransid();
			}
		}

		return "hireInfo-openReserveUpdate";
	}

	/**
	 * --hk判断当前网店是否有相关服务。
	 * @throws IOException 
	 */
	public void vasiftobo() throws IOException {
		if ("1".equals(vastype)) {// 取车网店，触发
			Vas vaso = this.orderExService.findVasbo(subOrder.getGetcarstoreid(), Constant.PROD_VASTYPE_0101);
			if (vaso != null) {
				if (vaso.getVasprice() != null) {
					vas1 = "1";
				}
			}
			Vas vass = this.orderExService.findVasbo(subOrder.getGetcarstoreid(), Constant.PROD_VASTYPE_0102);
			if (vass != null) {
				if (vass.getVasprice() != null) {
					vas2 = "1";
				}
			}
		} else {// 还车网店，触发
			Vas vass = this.orderExService.findVasbo(subOrder.getGetcarstoreid(), Constant.PROD_VASTYPE_0102);
			if (vass != null) {
				if (vass.getVasprice() != null) {
					vas2 = "1";
				}
			}
		}
		String vas = "0";
		if ("1".equals(vas1) && "1".equals(vas2)) {
			vas = "3";
		} else if ("1".equals(vas1)) {
			vas = "1";
		} else if ("1".equals(vas2)) {
			vas = "2";
		}
		HttpServletResponse response = Struts2Utils.getResponse();
		PrintWriter out = response.getWriter();
		out.print(vas);
		out.close();
	}

	// 定点接送 查询指定子订单
	public String shuquerySubOrderBysid() {
		if (StringUtils.isNotEmpty(sid)) {
			subOrder = orderExService.querySubOrderBysid(sid);
			if (subOrder.getGetcartime() != null) {
				String times = subOrder.getGetcartime().toString();
				String hour = times.substring(11, 13);
				String minute = times.substring(14, 16);
				subOrder.setHour(hour);
				subOrder.setMinute(minute);
			}
			if (StringUtils.isNotEmpty(subOrder.getVtno())) {
				vtimg = orderExService.getVtimage(subOrder.getVtno());
			}
		}
		User user = (User) Struts2Utils.getCurrentUser();
		setupUserClassifycation(user);
		if (subOrder == null && Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation())) {// 网店进入子订单预订页面
			StoreInfo storeInfo = this.storeInfoManager.getSelectBySid(user.getColldeptsid());
			if (storeInfo != null) {
				subOrder = new SubOrder();
				subOrder.setGetstorename(storeInfo.getStorename());
				subOrder.setStoreno(storeInfo.getStoreno());
				subOrder.setGetcarstoreid(storeInfo.getSid());
				subOrder.setReturnstorename(storeInfo.getStorename());
				subOrder.setReturncarstoreid(storeInfo.getSid());
				fransid = storeInfo.getFransid();
			}
		}
		return "shuhireInfo-openReserveUpdate";
	}

	// 删除子订单
	public void deleteSubOrderBysid() throws IOException {

		if (StringUtils.isNotEmpty(msid)) {
			subOrderList = orderExService.querySubList(msid);
			if (null != subOrderList) {
				if (subOrderList.size() == 1) {
					fransid = "";// edit by sun 2012-3-30
				}
			}
		}

		if (StringUtils.isNotEmpty(sid)) {
			orderExService.deleteSubOrderBysid(sid);
		}

		Struts2Utils.getResponse().sendRedirect(
				"order!querySubOrderList.action?msid=" + msid + "&optType=" + optType + "&fransid=" + fransid
						+ "&ordType=" + ordType);
		// 重定向URL
		// return querySubOrderList();
	}

	/**
	 * 微调订单查询参数 
	 */
	private void tuneQueryParams() {
		// orderCatQueryService.queryOrderList(page, simpleOrder);
		if (null != simpleOrder) {
			if (StringUtils.isNotEmpty(simpleOrder.getOrdtype())
					&& Constant.Order.ORDER_TYPE_2.equals(simpleOrder.getOrdtype())) {
				if (StringUtils.isNotEmpty(simpleOrder.getCustname())) {
					simpleOrder.setConame(simpleOrder.getCustname());
					simpleOrder.setCustname("");
				}
				if (StringUtils.isNotEmpty(simpleOrder.getIdcard())) {
					simpleOrder.setCoidcard(simpleOrder.getIdcard());
					simpleOrder.setIdcard("");
				}
				if (StringUtils.isNotEmpty(simpleOrder.getCustphone())) {
					simpleOrder.setCophone(simpleOrder.getCustphone());
					simpleOrder.setCustphone("");
				}
			}

			if (StringUtils.isEmpty(simpleOrder.getOrdtype())) {
				simpleOrder.setConame(simpleOrder.getCustname());
				simpleOrder.setCoidcard(simpleOrder.getIdcard());
				simpleOrder.setCophone(simpleOrder.getCustphone());
			}
		} else {
			simpleOrder = new SimpleOrder();
		}
	}
	private String userType = null;
	private StoreInfo storeInfo;
	private Franchisee franchisee;
	//控制页面显示加盟商和网点查询条件 --Add by TommyDeng
	/** 加盟商 */
	@Autowired
	private FranchiseeManager franchiseeManager;
	
	private void orderMgrIndex(String mt) {

		if (StringUtils.isNotEmpty(csMark)) {// sun 预定服务中心--过滤掉“，”号
			if (csMark.lastIndexOf(",") >= 0) {
				csMark = csMark.substring(0, csMark.indexOf(","));
			}
		}

		tuneQueryParams();
		if (mt.equals(Constant.RMENU_0)) {// 待清洗数据查询
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_0);
		} else if (mt.equals(Constant.RMENU_1)) {// 综合查询
		} else if (mt.equals(Constant.RMENU_2)) {
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_1);// 预订维护
		} else if (mt.equals(Constant.RMENU_3)) {
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_2);// 订单确认
		} else if (mt.equals(Constant.RMENU_4)) {
			List<String> list = new ArrayList<String>();
			list.add(Constant.Order.ORDER_STATUS_3);
			list.add(Constant.Order.ORDER_STATUS_4);
			simpleOrder.setStatus(list);// 租车办理(退回修改、已确认)
		} else if (mt.equals(Constant.RMENU_5)) {
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_5); // 出车任务
			// TODO
		} else if (mt.equals(Constant.RMENU_6)) {

			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_6);// 续租管理
		} else if (mt.equals(Constant.RMENU_9)) {
			simpleOrder.setServicetype2(Constant.Order.ORDER_TYPE_7); // 顺风车无换车
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_6);// 换车管理
		} else if (mt.equals(Constant.RMENU_7)) {
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_6);// 还车任务
		} else if (mt.equals(Constant.RMENU_8)) {
			List<String> list = new ArrayList<String>();
			// list.add(Constant.Order.ORDER_STATUS_4);
			// list.add(Constant.Order.ORDER_STATUS_5);
			list.add(Constant.Order.ORDER_STATUS_6);
			// list.add(Constant.Order.ORDER_STATUS_7);
			list.add(Constant.Order.ORDER_STATUS_8);
			simpleOrder.setServicetype3(Constant.RMENU_8);
			simpleOrder.setStatus(list);// 费用结算
			
		} else if (mt.equals(Constant.RMENU_10)) {
			simpleOrder.setIsapproval(Constant.YES);// 还车任务
		} else if (mt.equals(Constant.RMENU_11)) {
			simpleOrder.setOrdstatus(Constant.Order.ORDER_STATUS_12);// 审核作废待
		} else {
			return;
		}
        
		User user = (User) Struts2Utils.getCurrentUser();
		// System.out.println(userGroupFlag);
		if (null != user) {
			userType = user.getClassifycation();
			if (null != user.getClassifycation() && Constant.Sys.USERS_TYPE_2.equals(user.getClassifycation())) {
				// 加盟商用户
				franchisee = franchiseeManager.getFranchisee(user.getColldeptsid());
				simpleOrder.setFranchiseesid(user.getColldeptsid());// 加盟商用户限定查询范围为当前加盟商200402
				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.YES;
			} else if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_1.equals(user.getClassifycation()))) { // 管理中心

				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.NO;

			} else if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_4.equals(user.getClassifycation()))) { // 预定中心

				if (Constant.RMENU_2.equals(menuType)) {// 在预定维护中预定中心只需要看到预定中心的单
					simpleOrder.setChannel(Constant.CHANNETYPE_03);
				}
				page = orderCatQueryService.queryOrderList(page, simpleOrder);
				userGroupFlag = Constant.NO;
			} else if (null != user.getClassifycation() && (Constant.Sys.USERS_TYPE_5.equals(user.getClassifycation()))) { // 网点用户
				storeInfo = storeInfoManager.getBySid(user.getColldeptsid());
				franchisee = franchiseeManager.getFranchisee(storeInfo.getFransid());
				// if (store != null && store.getFransid() != null) {
				// simpleOrder.setFranchiseesid(store.getFransid());//
				// 加盟商用户限定查询范围为当前加盟商 sun注释于2012-4-21
				// }
				simpleOrder.setStoreid(storeInfo.getSid());
				page = orderCatQueryService.queryOrderList(page, simpleOrder);

			} else {
				if (StringUtils.isNotEmpty(simpleOrder.getFranchiseesid())) {
					page = orderCatQueryService.queryOrderList(page, simpleOrder);
				} else {
					page = new Page<SimpleOrder>();
				}
				userGroupFlag = Constant.YES;
			}
		}
		if (page != null && (null != page.getResult()) && page.getResult().isEmpty()) {
			page.setTotalItems(0L);
		}
	}

	/**
	 * 重新返回入口菜单对应首页
	 */
	private String invokeLastUrl() {
		String key = String.valueOf(session.get(LAST_URL_KEY));
		menuType = key;
		if (key.equals(Constant.RMENU_2)) {
			return orderMenuReserve();
		} else if (key.equals(Constant.RMENU_3)) {
			return orderMenuConfirm();
		} else if (key.equals(Constant.RMENU_4)) {
			return orderMenuHandle();
		} else if (key.equals(Constant.RMENU_5)) {
			return orderMenuDispatch();
		} else if (key.equals(Constant.RMENU_6)) {
			return orderMenuRelet();
		} else if (key.equals(Constant.RMENU_7)) {
			return orderMenuCollect();
		} else if (key.equals(Constant.RMENU_8)) {
			return orderMenuClear();
		} else if (key.equals(Constant.RMENU_9)) {
			return orderMenuChange();
		} else if (key.equals(Constant.RMENU_10)) {
			return orderMenuApproval();
		} else if (key.equals(Constant.RMENU_11)) {
			return orderMenuApprovalForDiscard();
		} else {
			return orderMenuIntQuery();
		}
	}

	/**
	 * --hk
	 *  进入费用变更申请页面
	 */
	public String feeApprovalbyid() throws Exception {
		approval = this.feeApprovalManager.FeeApprovalbyid(sid);
		return "order_FeeApproval";
	}

	/**
	 * --hk
	 *  进入费用变更申请 详情
	 */
	public String feeApprovalbyidinfo() throws Exception {
		approval = this.feeApprovalManager.FeeApprovalbyid(sid);
		return "order_FeeApprovalinfo";
	}
	
	/**
	 * 提交作废订单
	 */
	public String discardForm() {
		User user = (User) Struts2Utils.getCurrentUser();
		if (null != user) {
			orderManager.discardForm(this.msid,user);
		}
		return invokeLastUrl();
	}
	
	private OrderDiscard approvalForDiscard;
	/**
	 * --hk
	 *  进入作废订单申请页面
	 */
	public String feeApprovalbyidForDiscard() throws Exception {
		approvalForDiscard = this.orderManager.getOrderDiscardBySid(sid);
		return "order_FeeApprovalForDiscard";
	}

	/**
	 * --hk
	 *  进入作废订单申请 详情
	 */
	public String feeApprovalbyidinfoForDiscard() throws Exception {
		approvalForDiscard = this.orderManager.getOrderDiscardBySid(sid);
		return "order_FeeApprovalinfoForDiscard";
	}
	
	public String approvalForDiscard() throws Exception {
		User user = (User) Struts2Utils.getCurrentUser();
		if (user != null && approvalForDiscard != null) {
			approvalForDiscard.setApprover(user.getUserName());
			approvalForDiscard.setApprovetime(new Date());
			orderManager.applyOrderDiscard(approvalForDiscard);
			
			//防止重复弹出提示框
			if("".equals(closType)){//
				closType = "1";
			}else{
				closType = "2";
			}
		}
		return "order_FeeApprovalForDiscard";
	}
	
	
	@Override
	protected void prepareModel() throws Exception {}

	@Override
	public String save() throws Exception {
		return RELOAD;
	}

	@Override
	public VirtualOrder getModel() {
		return null;
	}

	public VirtualOrder getVirtualOrder() {
		return virtualOrder;
	}

	public void setVirtualOrder(VirtualOrder virtualOrder) {
		this.virtualOrder = virtualOrder;
	}

	@Override
	public String input() throws Exception {
		return null;
	}

	@Override
	public String delete() throws Exception {
		return null;
	}

	@Override
	public String list() throws Exception {
		return null;
	}

	public Page<SimpleOrder> getPage() {
		return page;
	}

	public void setPage(Page<SimpleOrder> page) {
		this.page = page;
	}

	public void setSimpleOrder(SimpleOrder simpleOrder) {
		this.simpleOrder = simpleOrder;
	}

	public SimpleOrder getSimpleOrder() {
		return simpleOrder;
	}

	public FreeRide getFreeride() {
		return freeride;
	}

	public void setFreeride(FreeRide freeride) {
		this.freeride = freeride;
	}

	public String getUserGroupFlag() {
		return userGroupFlag;
	}

	public void setUserGroupFlag(String userGroupFlag) {
		this.userGroupFlag = userGroupFlag;
	}

	public void setMsid(String msid) {
		this.msid = msid;
	}

	public String getMsid() {
		return msid;
	}

	public File[] getUpload() {
		return upload;
	}

	public void setUpload(File[] upload) {
		this.upload = upload;
	}

	public String[] getUploadContentType() {
		return uploadContentType;
	}

	public void setUploadContentType(String[] uploadContentType) {
		this.uploadContentType = uploadContentType;
	}

	public String[] getUploadFileName() {
		return uploadFileName;
	}

	public void setUploadFileName(String[] uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	public String[] getImageFiles() {
		return imageFiles;
	}

	public void setImageFiles(String[] imageFiles) {
		this.imageFiles = imageFiles;
	}

	public String getOrdType() {
		return ordType;
	}

	public void setOrdType(String ordType) {
		this.ordType = ordType;
	}

	public String getMenuType() {
		return menuType;
	}

	public void setMenuType(String menuType) {
		this.menuType = menuType;
	}

	public String getOptType() {
		return optType;
	}

	public void setOptType(String optType) {
		this.optType = optType;
	}

	public String getButtonType() {
		return buttonType;
	}

	public void setButtonType(String buttonType) {
		this.buttonType = buttonType;
	}

	public String getSid() {
		return sid;
	}

	public void setSid(String sid) {
		this.sid = sid;
	}

	// sun
	public SubOrder getSubOrder() {
		return subOrder;
	}

	public String getIsBorder() {
		return isBorder;
	}

	public void setIsBorder(String isBorder) {
		this.isBorder = isBorder;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getOldsubsid() {
		return oldsubsid;
	}

	public void setOldsubsid(String oldsubsid) {
		this.oldsubsid = oldsubsid;
	}

	public String getVsid() {
		return vsid;
	}

	public void setVsid(String vsid) {
		this.vsid = vsid;
	}

	public String getVtimg() {
		return vtimg;
	}

	public void setVtimg(String vtimg) {
		this.vtimg = vtimg;
	}

	public Vehicle getVehicle() {
		return vehicle;
	}

	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	public String getFransid() {
		return fransid;
	}

	public void setFransid(String fransid) {
		this.fransid = fransid;
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public String getClosType() {
		return closType;
	}

	public void setClosType(String closType) {
		this.closType = closType;
	}

	public List<SubOrder> getSubOrderList() {
		return subOrderList;
	}

	public void setSubOrderList(List<SubOrder> subOrderList) {
		this.subOrderList = subOrderList;
	}

	public void setSubOrder(SubOrder subOrder) {
		this.subOrder = subOrder;
	}

	public String getOldsubtype() {
		return oldsubtype;
	}

	public void setOldsubtype(String oldsubtype) {
		this.oldsubtype = oldsubtype;
	}

	public String getSkip() {
		return skip;
	}

	public void setSkip(String skip) {
		this.skip = skip;
	}

	public String getCsMark() {
		return csMark;
	}

	public void setCsMark(String csMark) {
		this.csMark = csMark;
	}

	public String getCustno() {
		return custno;
	}

	public void setCustno(String custno) {
		this.custno = custno;
	}

	public String getYemianName() {
		return yemianName;
	}

	public void setYemianName(String yemianName) {
		this.yemianName = yemianName;
	}

	public String getH_servicetype() {
		return h_servicetype;
	}

	public void setH_servicetype(String h_servicetype) {
		this.h_servicetype = h_servicetype;
	}

	public String getFreeridesid() {
		return freeridesid;
	}

	public void setFreeridesid(String freeridesid) {
		this.freeridesid = freeridesid;
	}

	public String getVcollectformtype() {
		return vcollectformtype;
	}

	public void setVcollectformtype(String vcollectformtype) {
		this.vcollectformtype = vcollectformtype;
	}

	public String getVregistrationformtype() {
		return vregistrationformtype;
	}

	public void setVregistrationformtype(String vregistrationformtype) {
		this.vregistrationformtype = vregistrationformtype;
	}

	public File[] getUploads() {
		return uploads;
	}

	public void setUploads(File[] uploads) {
		this.uploads = uploads;
	}

	public String[] getUploadsContentType() {
		return uploadsContentType;
	}

	public void setUploadsContentType(String[] uploadsContentType) {
		this.uploadsContentType = uploadsContentType;
	}

	public String[] getUploadsFileName() {
		return uploadsFileName;
	}

	public void setUploadsFileName(String[] uploadsFileName) {
		this.uploadsFileName = uploadsFileName;
	}

	public String getTabtype() {
		return tabtype;
	}

	public void setTabtype(String tabtype) {
		this.tabtype = tabtype;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public String getApprovalStatus() {
		return approvalStatus;
	}

	public void setApprovalStatus(String approvalStatus) {
		this.approvalStatus = approvalStatus;
	}

	public FeeApproval getApproval() {
		return approval;
	}

	public void setApproval(FeeApproval approval) {
		this.approval = approval;
	}

	public String getJoinfreeride() {
		return joinfreeride;
	}

	public void setJoinfreeride(String joinfreeride) {
		this.joinfreeride = joinfreeride;
	}

	public String getOffsite() {
		return offsite;
	}

	public void setOffsite(String offsite) {
		this.offsite = offsite;
	}

	public String getErrorsto() {
		return errorsto;
	}

	public void setErrorsto(String errorsto) {
		this.errorsto = errorsto;
	}

	public List<Resloss> getReslosslist() {
		return reslosslist;
	}

	public void setReslosslist(List<Resloss> reslosslist) {
		this.reslosslist = reslosslist;
	}

	public List<RgUsedout> getRgUsedouts() {
		return rgUsedouts;
	}

	public void setRgUsedouts(List<RgUsedout> rgUsedouts) {
		this.rgUsedouts = rgUsedouts;
	}

	public Date getOuttime() {
		return outtime;
	}

	public void setOuttime(Date outtime) {
		this.outtime = outtime;
	}

	public List<RGUsed> getRgUseds() {
		return rgUseds;
	}

	public void setRgUseds(List<RGUsed> rgUseds) {
		this.rgUseds = rgUseds;
	}

	public Date getReturntime() {
		return returntime;
	}

	public void setReturntime(Date returntime) {
		this.returntime = returntime;
	}

	public List<RgUsedreturn> getRgUsedreturns() {
		return rgUsedreturns;
	}

	public void setRgUsedreturns(List<RgUsedreturn> rgUsedreturns) {
		this.rgUsedreturns = rgUsedreturns;
	}

	public List<VASUsed> getVasUseds() {
		return vasUseds;
	}

	public void setVasUseds(List<VASUsed> vasUseds) {
		this.vasUseds = vasUseds;
	}

	public List<INSUsed> getInsUseds() {
		return insUseds;
	}

	public void setInsUseds(List<INSUsed> insUseds) {
		this.insUseds = insUseds;
	}

	public List<Downlossinfo> getDownlossinfolist() {
		return downlossinfolist;
	}

	public void setDownlossinfolist(List<Downlossinfo> downlossinfolist) {
		this.downlossinfolist = downlossinfolist;
	}

	public VirtualServer getVirtualServer() {
		return virtualServer;
	}

	public void setVirtualServer(VirtualServer virtualServer) {
		this.virtualServer = virtualServer;
	}

	public String getCurrfransid() {
		return currfransid;
	}

	public void setCurrfransid(String currfransid) {
		this.currfransid = currfransid;
	}

	public String getRentaltype() {
		return rentaltype;
	}

	public void setRentaltype(String rentaltype) {
		this.rentaltype = rentaltype;
	}

	public List<FeeApproval> getApprovallist() {
		return approvallist;
	}

	public void setApprovallist(List<FeeApproval> approvallist) {
		this.approvallist = approvallist;
	}

	public String getStoreid() {
		return storeid;
	}

	public void setStoreid(String storeid) {
		this.storeid = storeid;
	}

	public String getFransidto() {
		return fransidto;
	}

	public void setFransidto(String fransidto) {
		this.fransidto = fransidto;
	}

	public String getIsHandleboo() {
		return isHandleboo;
	}

	public void setIsHandleboo(String isHandleboo) {
		this.isHandleboo = isHandleboo;
	}

	public String getVas1() {
		return vas1;
	}

	public void setVas1(String vas1) {
		this.vas1 = vas1;
	}

	public String getVas2() {
		return vas2;
	}

	public void setVas2(String vas2) {
		this.vas2 = vas2;
	}

	public String getVastype() {
		return vastype;
	}

	public void setVastype(String vastype) {
		this.vastype = vastype;
	}

	public String getCsoperate() {
		return csoperate;
	}

	public void setCsoperate(String csoperate) {
		this.csoperate = csoperate;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public StoreInfo getStoreInfo() {
		return storeInfo;
	}

	public void setStoreInfo(StoreInfo storeInfo) {
		this.storeInfo = storeInfo;
	}

	public Franchisee getFranchisee() {
		return franchisee;
	}

	public void setFranchisee(Franchisee franchisee) {
		this.franchisee = franchisee;
	}

	public List getApprovaldiscardlist() {
		return approvaldiscardlist;
	}

	public void setApprovaldiscardlist(List approvaldiscardlist) {
		this.approvaldiscardlist = approvaldiscardlist;
	}

	public OrderDiscard getApprovalForDiscard() {
		return approvalForDiscard;
	}

	public void setApprovalForDiscard(OrderDiscard approvalForDiscard) {
		this.approvalForDiscard = approvalForDiscard;
	}

	public String getOptinsureFlag() {
		return optinsureFlag;
	}

	public void setOptinsureFlag(String optinsureFlag) {
		this.optinsureFlag = optinsureFlag;
	}

}